package com.rxyb.security.model;

import com.rxyb.security.config.JwtConfig;
import lombok.Data;
import lombok.ToString;

/**
 * @author YJH
 * @version 1.0
 * @description JWT 请求参数设置
 * @date 2020/5/17  15:55
 */
@Data
@ToString
public class Jwt {

    /**头部*/
    private String header;

    /**负载*/
    private String payload;

    /** 签名*/
    private String signature;


    public Jwt() {
    }

    public Jwt(String payload) throws Exception {
        this.header = JwtConfig.encode(JwtConfig.DEFAULT_HEADER);
        this.payload = JwtConfig.encode(payload);
        this.signature = JwtConfig.getSignature(payload);
    }
    public Jwt(String header, String payload, String signature) {
        this.header = header;
        this.payload = payload;
        this.signature = signature;
    }
}
